home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 25
/
AMIGAplus Sonderheft 25 (2000)(Falke)(DE)(Track 1 of 4)[!].iso
/
Updates
/
HD-Installer
/
-WHDLoad-
/
WHDLoad_dev
/
Autodoc
/
whdload.doc
Wrap
Text File
|
2000-05-08
|
47KB
|
1,278 lines
TABLE OF CONTENTS
WHDLoad/--Overview--
WHDLoad/resload_Abort
WHDLoad/resload_Control
WHDLoad/WHDLTAG_CBSWITCH_SET
WHDLoad/resload_CRC16
WHDLoad/resload_Decrunch
WHDLoad/resload_DiskLoad
WHDLoad/resload_DiskLoadDev
WHDLoad/resload_FlushCache
WHDLoad/resload_GetFileSize
WHDLoad/resload_ListFiles
WHDLoad/resload_LoadFile
WHDLoad/resload_LoadFileDecrunch
WHDLoad/resload_LoadFileOffset
WHDLoad/resload_ProtectRead
WHDLoad/resload_ProtectReadWrite
WHDLoad/resload_ProtectRemove
WHDLoad/resload_ProtectWrite
WHDLoad/resload_SaveFile
WHDLoad/resload_SaveFileOffset
WHDLoad/resload_SetCACR
WHDLoad.Slave/--Overview--
WHDLoad/--Overview--
The calling conventions for all functions are similar to the OS-Library-
concept. Parameters are provided in registers (except "resload_Abort"),
return codes comes in D0 (on some functions also in D1). After a function call
the registers D0-D1/A0-A1 are destroyed (D0,D1 may contain a returncode) they
are so called scratch registers. All other registers are preserved.
The base of the JMP tower in WHDLoad is similar to a LibraryBase. In
difference to the OS the base must not stand in A6 on calling a function, but
it is recommend to call all functions relative to a address register like
move.l (_resload,pc),a5
JMP (resload_Decrunch,a5)
The resload base is overgiven in A0 on calling the Slave first via
ws_GameLoader (see chapter WHDLoad.Slave/--Overview--).
explanation of some keywords used in this document:
Slave the file which contains the interface code
(see chapter WHDLoad.Slave/--Overview--)
DiskImage a Floppy-disk stored as a file on Harddisk
BaseMem the size of the memory used by the installed program
this value is specified in the Slave : ws_BaseMemSize
this is also the upper bound of chip-mem for the installed
program
logical values used for returncodes (see dos/dos.i):
TRUE = -1 (or better <>0)
FALSE = 0
WHDLoad/resload_Abort
NAME
resload_Abort -- quit and return to operating system
SYNOPSIS
resload_Abort( success, primary, secondary)
(a7) (4,a7) (8,a7)
ULONG ULONG ULONG
FUNCTION
terminates the program and return to OS
INPUTS
success - the reason for terminating
one of TDREASON_#? ,defined in "whdload.i"
depending on this value WHDLoad will continue different
TDREASON_OK
a normal exit will performed
TDREASON_DEBUG
WHDLoad will make a memory dump to .whdl_memory and a
register dump to .whdl_register after this it will exit
TDREASON_#? (except the above)
WHDLoad will show an requester which displays the reason
of failure, the user can now choose between "Quit",
"Restart" and "Make CoreDump"
primary - the primary errorcode, depends on success/TDREASON_#?
TDREASON_DOSREAD,TDREASON_DOSWRITE,TDREASON_DOSLIST,
TDREASON_DISKLOAD,TDREASON_DISKLOADDEV
--> dos-errorcode/trackdisk-errorcode
TDREASON_DEBUG
--> program counter (to write it to the register dump)
secondary - the secondary errorcode, depends on success/TDREASON_#?
TDREASON_DOSREAD,TDREASON_DOSWRITE,TDREASON_DOSLIST
--> pointer to filename
TDREASON_DISKLOAD
--> disk number
TDREASON_DEBUG
--> status register (to write it to the register dump)
EXAMPLE
to simply quit:
;primary and secondary wont be needed
move.l #TDREASON_OK,-(a7)
move.l (_resload,pc),a0
jmp (resload_Abort,a0)
to quit because reading of a file has failed:
move.l a0,-(a7) ;a0 = filename
move.l d0,-(a7) ;d0 = doserror code
move.l #TDREASON_DOSREAD,-(a7)
move.l (_resload,pc),-(a7)
add.l #resload_Abort,(a7)
rts
RESULT
nothing because WHDLoad will never return from this call
BUGS
NOTE
this routine is the only which must called via JMP and not JSR,
because the parameters lies on the stack
(this has the advantage that if success==TDREASON_DEBUG the registers
can preserved)
SEE ALSO
example slaves
WHDLoad/resload_Control
NAME
resload_Control
SYNOPSIS
success = resload_Control(taglist)
D0 A0
BOOL APTR
FUNCTION
control function of WHDLoad, get variables from WHDLoad,
set variables in WHDLoad depending on the tags in the overgiven
taglist
INPUTS
taglist - pointer to a table of tagitems
WHDLTAG_ATTNFLAGS_GET - gets the AttnFlags from systems execbase
WHDLTAG_ECLOCKFREQ_GET - gets the EClockFrequency from systems
execbase
WHDLTAG_MONITOR_GET - gets the used monitor, the value will be
eiter NTSC_MONITOR_ID or PAL_MONITOR_ID
(defined in graphics/modeid.i), the used
monitor depends on execbase.VBlankFrequency
and can set by the user via tooltypes
NTSC and PAL
WHDLTAG_BUTTONWAIT_GET - returns -1 if argument/tooltype ButtonWait
is set, otherwise returns 0
WHDLTAG_CUSTOM1_GET
WHDLTAG_CUSTOM2_GET
WHDLTAG_CUSTOM3_GET
WHDLTAG_CUSTOM4_GET
WHDLTAG_CUSTOM5_GET - returns numerical value of argument/tooltype
Custom1 .. Custom5
WHDLTAG_CBSWITCH_SET - sets callback function to execute on switch
to installed program
EXAMPLE
...
clr.l -(a7) ;TAG_DONE
clr.l -(a7) ;data to fill
move.l #WHDLTAG_ATTNFLAGS_GET,-(a7)
move.l a7,a0
move.l (_resload,pc),a2
jsr (resload_Control,a2)
move.w (6,a7),d0 ;D0 = AttnFlags
lea (12,a7),a7 ;restore sp
...
EXAMPLE
...
lea (_tags,pc),a0
move.l (_resload,pc),a2
jsr (resload_Control,a2)
move.w (_attn,pc),d0 ;D0 = AttnFlags
...
_tags
dc.l WHDLTAG_MONITOR_GET
_mon dc.l 0
dc.l WHDLTAG_ATTNFLAGS_GET
dc.w 0 ;padding
_attn dc.w 0
dc.l 0 ;TAG_DONE
RESULT
success is true if all tags in the taglist are correctly processed
GET items in the taglist are filled with the requested data
BUGS
NOTE
requires ws_Version >= 5
SEE ALSO
WHDLoad/WHDLTAG_CBSWITCH_SET
NAME
WHDLTAG_CBSWITCH_SET
SYNOPSIS
to be used with resload_Control
FUNCTION
with this tag a function can be set which will executed from WHDLoad
when it switches from the OS to the installed program, the aim is to
give a possebilty to fix the problem that some Custom registers are
destroyed during such a switch
at the time this routine will be executed all interrupts and dma's are
disabled and the installed programs memory is restored
the function MUST not change any register, MUST not use stack and MUST
return via "JMP (A0)"
known r